<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="author" content="何毓堂">
        <title></title>
         <link rel="stylesheet" type="" href="">
       <style>
        .box {
            width: 500px;
            height: 350px;
            margin: 0 auto;
            background-color: hotpink;
            text-align: center;
        }

        textarea {
            margin-top: 50px;
        }
    </style>
</head>

<body>
    <div class="box">
        <textarea rows="10" cols="55"></textarea>
        <p>已经输入0个字</p>
    </div>
    <script src="./jquery.js">

    </script>
</body>

</html>
<script>
    var ziti = 0;
    $('textarea').on('input propertychange',function () {       
    var count = 0 ;
   ziti = $('textarea').val();
        for (var i = 0; i < $(this).val().length; i++) {
            if (ziti.charCodeAt(i) < 255) {
                count = count + 0.5
            }else {
                count = count + 1;
            }
        }
        if(count > 140){
            $('p').html('您已输入' + Math.ceil(count) + '个字').css('color','red');                            
        }else{
            $('p').html('您已输入' + Math.ceil(count) + '个字').css('color','black');                
        }
    });

</script>